// 定义关联值
enum Barcode {
    case upc(Int, Int, Int, Int)
    case qrCode(String)
}

// 可以通过 `let` 或 `var` 解构关联值：
var productCode = Barcode.upc(8, 85909, 51226, 3)

switch productCode {
case .upc(let numberSystem, let manufacturer, let product, let check):
    print("UPC: \(numberSystem), \(manufacturer), \(product), \(check)")
case .qrCode(let code):
    print("QR Code: \(code)")
}
